{include file="public_head" /}
<!-- Select2 -->

<link href="__STATIC__/css/select/select2.min.css" rel="stylesheet">
<!-- datatables -->
<link href="__STATIC__/js/datatables/jquery.dataTables.min.css" rel="stylesheet" type="text/css"/>
<!-- chk_3 -->
<link href="__STATIC__/css/chk_3.css" rel="stylesheet" type="text/css"/>

<body class="nav-md">

<div class="container body">


    <div class="main_container">

        {include file="public_sidebar,public_nav" /}

        <!-- page content -->
        <div class="right_col" role="main">
            <div class="">
                <div class="page-title">
                    <div class="title_left">
                        <h3>

                        </h3>
                    </div>
                </div>
                <div class="clearfix"></div>

                <div class="row">

                    <div class="col-md-12 col-sm-12 col-xs-12">
                            <div class="x_title">
                                <h2>门店管理</h2>
                               {eq name=":session('auding_status')" value="2"} <a style="float: right" href="{:url('create')}"
                                                        class="btn btn-success btn-sm">创建门店</a>{/eq}
                                <div class="clearfix"></div>
                            </div>
                            {eq name='$auding_status' value="2"}
                            <div class="title_left">
                                <form name="form"  method="get" action="">
                                <div class="input-group col-md-2 col-sm-3 col-xs-4" style="float: left;margin: 0 2%;">
                                    <select name="area_id" class="select2_single" style="width: 100%;"
                                            tabindex="-1">
                                        <option value="0">- 请选择所在城市 -</option>
                                        {foreach :model('area')->where('area_deep',2)->select() as $key=>$vo }
                                        <option value="{$vo.area_id}" {eq name=':input("area_id")' value='$vo.area_id' }selected{/eq}>{$vo.area_name}</option>
                                        {/foreach}
                                    </select>
                                </div>
                                    <div class="input-group" style="float: left;margin: 0 20px; position: relative;z-index: 10000">
                                        <input type="text" class="form-control" name="interval_timer"
                                               id="interval_timer"
                                               style="width: 200px;"
                                               placeholder="请选择时间区间..." value="{:input('interval_timer')}">
                                    </div>
                                <div class="col-md-2 col-sm-3 col-xs-3 form-group pull-left top_search">
                                    <div class="input-group">
                                        <input type="text" class="form-control" name="title"
                                               placeholder="输入搜下内容..." value="{:input('title')}">
                                    </div>

                                </div>

                                <button type="submit" class="btn btn-primary" style="margin-left: 10px;">搜 索

                                </button>
                                </form>
                            </div>
                            {/eq}
                            <div class="x_content">
                                <form name="form" id="form" method="post" action="">

                                    <table style="border-bottom:1px solid #ddd;"
                                           class="table table-striped table-bordered table-hover">
                                        <thead>
                                        <tr class="success">
                                            <!--<th style="width: 2%; padding: 10px;">-->
                                                <!--<input type="checkbox" class="checkall"-->
                                                       <!--onclick="CheckAll(this.checked);"/>-->
                                            <!--</th>-->
                                            <!--<th>排序</th>-->
                                            <th width="30">ID</th>
                                            <th>所在城市</th>
                                            <th width="">当前绑定管理员</th>
                                            <th width="">门店名称</th>
                                            <th width="">店主账号</th>
                                            <th width="">店主姓名</th>
                                            <th width="">创建时间</th>
                                            <th width="">审核状态</th>
                                            <th width="">一级审核</th>
                                            <th width="">二级审核</th>
                                            <th width="">三级审核</th>
                                            <th>当前状态</th>
                                            <th>服务数量</th>
                                            <th>等待时长-设置时长</th>
                                            <th>排序</th>
                                            <th>操作</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        {empty name="data"}
                                            <tr><td colspan="12"><div style='font-size:24px;margin:30px 0;'>没有找到记录</div></td></tr>
                                        {/empty}
                                        {volist name="data" id="item"}
                                        <tr >
                                            <td>{$item.id}</td>
                                            <td>{$item.area_name}</td>
                                            <td>{$item.username}</td>
                                            <td>{$item.shop_title}</td>
                                            <td>{$item.shop_phone}</td>
                                            <td>{$item.shop_name}</td>
                                            <td>{$item.create_time}</td>
                                            <td>{$item.auding_text}</td>
                                            <td>{$item.auding_text1}</td>
                                            <td>{$item.auding_text2}</td>
                                            <td>{$item.auding_text3}</td>
                                            <td>{switch name="$item.shop_status"}
                                                    {case 1}空闲{/case}
                                                    {case 2}{switch name="$item.shop_status"}
                                                {case 1}空闲{/case}
                                                {case 2}{$item.wait_time_index}{/case}
                                                {/switch}{/case}
                                                {/switch}
                                            </td>
                                            <td>{$item.service_num}</td>
                                            <td>{switch name="$item.shop_status"}
                                                {case 1}空闲{/case}
                                                {case 2}{$item.wait_time_index}-{$item.wait_time_h}时{$item.wait_time_m}分{/case}
                                                {/switch}
                                            </td>
                                            <td>{$item.sort}</td>
                                            <td class="operate" >
                                                <div>

                                                    <a href="{:url('update', ['id' => $item['id']])}"
                                                       class="label label-primary">
                                                        <span class="fa fa-pencil"></span>&nbsp;&nbsp;编 辑
                                                    </a>
                                                    {eq name=":session('auding_status')" value="2"}
                                                    <a href="{:url('destroy', ['id' => $item['id']])}"
                                                       class="label label-danger"
                                                       onClick="return confirm('确定删除吗?')"
                                                    >
                                                        <span class="fa fa-times"></span>&nbsp;&nbsp;删 除
                                                    </a>
                                                    {neq name="$item.auding_status" value="2"}
                                                    <a href="{:url('update', ['id' => $item['id']])}"
                                                       class="label label-success">
                                                        <span class="fa fa-pencil"></span>&nbsp;&nbsp;审 核
                                                    </a>
                                                    {else/}
                                                    <a
                                                            class="label label-warning">
                                                        <span class="fa fa-pencil"></span>&nbsp;&nbsp;完 成
                                                    </a>
                                                    {/neq}
                                                    {/eq}

                                                </div>
                                            </td>
                                        </tr>
                                        {/volist}
                                        </tbody>
                                    </table>
                                    <div style="float: right;margin-top: -30px;">{$data->render()}</div>
                                    <button type="button" class="btn btn-info" style="margin-top: 20px;" onclick="dc({:input('coupon_id')})">门店导出</button>
                                </form>
                            </div>
                        </div>
                    </div>

                </div>
            </div>

        </div>
        <!-- /page content -->
    </div>

</div>

{include file="public_foot" /}
<!--select-->

<script src="__STATIC__/js/select/select2.full.min.js"></script>
<!-- public -->
<script src="__STATIC__/js/public.js"></script>
<!-- layer -->
<script src="__STATIC__/js/layer.js"></script>
<script type="text/javascript">

    // list

    $(document).ready(function () {

        // select2

        $(".select2_single").select2({

            placeholder: "请选择分类",

            allowClear: true

        });
        $('#interval_timer').daterangepicker(null,
            function(start, end, label) {
//                console.log(start.toISOString(), end.toISOString(), label);
            });
    });

    function dc(){
        var title = "{:input('title')}";
        var area_id = "{:input('area_id')}";
        var both = "{:input('interval_timer')}";
        window.location.href = "{:url('index')}?export=123&pa=10000"+status+"&title="+title+"&area_id="+area_id+'&interval_timer='+both;
    }

</script>
